In some video editing systems, special dedicated hardware processes streams of video data in a pipelined fashion to produce special effects. Such a system is disclosed, for example, in U.S. Pat. No. 5,654,737.
In other video editing systems, such as using Avid Cinema, or Adobe Premiere, special effects may be produced on a general-purpose computer using a computer program that instructs a general-purpose processor to perform the designated effects on video data in system memory. In such a system, the image data generally is processed within the system memory or other dedicated memory called an accumulation buffer. The process of rendering a special effect generally involves receiving compressed video data, decompressing it, and performing the effect to produce an uncompressed result. The uncompressed result often is compressed before it is stored.
In such systems, latencies involved in accessing, decompressing and processing an image to be used in an effect are compounded if each image is processed individually. Latencies may arise from decompression algorithms or hardware, or if image data either is retrieved from a remote file system, or if image data is the result of other processing.
Processing video data with a combination of one or more operations, such as special effects, on a general-purpose computer may be improved by enabling one or more operations to access and process multiple samples of video data from other operations that introduce latencies for each request for data. Operations that introduce latencies include, for example, hardware for decompression and compression, network interfaces, and file systems. Because a computer program to implement the operations may be executed on several different general-purpose platforms, exact specifications of available hardware are not known in advance. For each operation, a computer program determines the available system memory and an amount of data that can be processed by each operation used in a composition or portion of a composition while sharing the available memory with other operations. Available system memory is allocated among the operations being used.
Accordingly, memory for processing video data may be allocated by determining available memory. For each operation in a combination of one or more operations, a maximum amount of data that can be processed by the operation while sharing the available memory with the one or more operations is determined. The available memory is allocated according to the determined maximum amount of data that can be processed by each operation while sharing the available memory with the one or more operations.
The maximum amount of data may be determined by determining a maximum number of buffers used by the one or more operations in any branch of a tree that represents the combination of the one or more operations using the available memory. The number of samples each operation can process using the available memory may then be determined to allocate the maximum number of buffers.
The number of samples may be determined by dividing the amount of available memory by the maximum number of buffers to determine a maximum buffer size. This maximum buffer size may be divided by a size of each sample to provide the number of samples. Further, a minimum from among maximum amounts of data that can be provided by any of the one or more operations may be determined and used to limit the determined number of samples.
Latency in processing video data using a combination of one or more operations on a general purpose computer may be reduced by determining memory available to the one or more operations. For each operation in the combination of one or more operations, a maximum amount of data that can be processed by the operation while sharing the available memory with the one or more operations may be determined. The available memory may be allocated according to the determined maximum amount of data that can be processed by each operation while sharing the available memory with the one or more operations. The video data may be processed using the combination of the one or more operations, wherein each operation requests data from other operations, and wherein the other operations respond to such requests with a number of samples of data corresponding to the memory allocated for the operation.